-
Notifications
You must be signed in to change notification settings - Fork 243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
preflight: Ensure crc
network is accessible from session libvirt
#709
Conversation
@@ -32,6 +32,8 @@ const ( | |||
crcNetworkManagerConfigFile = "crc-nm-dnsmasq.conf" | |||
// This is defined in https://github.com/code-ready/machine-driver-libvirt/blob/master/go.mod#L5 | |||
minSupportedLibvirtVersion = "3.4.0" | |||
qemuBridgeConfigPath1 = "/etc/qemu/bridge.conf" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the difference? One is Fedora, RHEL and the other is ... ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
qemu is fedora, qemu-kvm is RHEL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
network or bridge?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/qemuBridgeConfigPath1/qemuBridgeConfigPathFedora
s/qemuBridgeConfigPath2/qemuBridgeConfigPathRHEL
or similar, as at the moment it is not clear why these paths are considered. And when distro specific checks are added, this becomes relevant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it was also on Debian, @cfergeau ? Hence the numbering instead of distro names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought of an array/list but didn't go for that since there is only 2 paths
It is a better solution to use a list, and still use a named variables in the list. readability and maintainability are also key.
I hope that good example makes follow ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We inform the user WHAT we do and FIX the issue so their system MEETS PREREQUISITES.
but @cfergeau said it's NOT an issue but a distro decision hence it's not as simple as that for me.
It is a better solution to use a list, and still use a named variables in the list. readability and maintainability are also key.
I don't see how list is more readable with just two cases here but ok. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not actually addressed the setuid
issue yet. According to this blog post, setuid is not set and /etc/qemu/bridge.conf
need to be manually created. Do we want this addressed already in this PR or can it be a followup?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd first code this around Fedora/RHEL, so a followup is fine with me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll resolve this once we merge the PR and I'll create an issue for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unclear why path1 and path2 are used, and small function refactor needed to remove the append parameter as no default value parameters are possible.
Linting issues:
|
One note about terminology, you are talking about 'crc network' in this pull request, which for me means 'crc libvirt network', while what the preflight checks really are doing is allowing the crc bridge (as seen in 'ip addr' for example) to be used by qemu:///session |
@cfergeau this might be due to us, but what would be 'easier' to understand to the user? |
As @gbraad said, it might be better to not confuse the user with too precise terminology here. |
There are several different things, in user-visible strings, we can discuss whether to use "crc network", "crc network device", "crc bridge"). |
PTALA. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prevent nested-if statements.
PTALA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of duplication remains
dfe0438
to
df61101
Compare
@zeenix looks like all the test are failing may be you need to check |
@praveenkumar I first need to make the latest changes work. :) I think i've fixed that on |
Add a utility function similar to WriteToFileAsRoot(), that appends to the specified path instead of overwriting the file. We use this in a following patch to append to Qemu bridge access configuration file.
Given a set of paths, it retrieves the first existent path.
This is needed to be able to switch to session libvirt, which will be through machine-driver-libvirt (See crc-org/machine-driver-libvirt#20)
This is to ensure that if we decided to change the network name in the future, the developer doesn't forget to change the bridge name as well.
This includes: * Deleting the `crc` VM from system libvirt. * Ensuring the disk image has the current user as owner.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Can one of the admins verify this patch? |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: zeenix The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@zeenix: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
We will reopen this PR if needed. crc-org/machine-driver-libvirt#20 is still opened. |
This is needed to be able to switch to session libvirt, which will be through machine-driver-libvirt (See crc-org/machine-driver-libvirt#20).